
*libname TP_Data "The location of the data folder\TP_Pseudo";




*** Table 8 ***;


* Model 1 *;

Proc sort DATA=TP_Data.Table_8_model_1 ;
by Ind_year_Dummy;
run;

Proc standard DATA=TP_Data.Table_8_model_1 out=Table_8_model_1_Ind_Year_Std mean=0;
by Ind_Year_Dummy;
run;

Proc autoreg data=Table_8_model_1_Ind_Year_Std plots=none;
   model Pct_traded_imbalance_01_STD_adj=  	TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
											All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
run;

Proc delete data=Table_8_model_1_Ind_Year_Std ; 
run;


* Model 2 *;

Proc sort DATA=TP_Data.Table_8_model_2 ;
by Analyst_year_Dummy;
run;

Proc standard DATA=TP_Data.Table_8_model_2 out=Table_8_model_2_Analyst_Year_Std mean=0;
by Analyst_year_Dummy;
run;

Proc autoreg data=Table_8_model_2_Analyst_Year_Std plots=none;
   model Pct_traded_imbalance_01_STD_adj=  	TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 											drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
run;

Proc delete data=Table_8_model_2_Analyst_Year_Std ; 
run;


* Model 3 *;

Proc sort DATA=TP_Data.Table_8_model_3 ;
by Ind_year_Dummy;
RUN;

Proc standard DATA=TP_Data.Table_8_model_3 out=Table_8_model_3_Ind_Year_Std mean=0;
by Ind_Year_Dummy;
RUN;

Proc autoreg data=Table_8_model_3_Ind_Year_Std plots=none;
   model TP_Retail_Trade_Imb_01_STD_adj=  	TP SB Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp gexp Portsize Portfolio_Complexity Relative_EPS_optimism
											All_Star drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_8_model_3_Ind_Year_Std ; run;



* Model 4 *;

Proc sort DATA=TP_Data.Table_8_model_4 ;
by Analyst_year_Dummy;
RUN;

Proc standard DATA=TP_Data.Table_8_model_4 out=Table_8_model_4_Analyst_Year_Std mean=0;
by Analyst_year_Dummy;
RUN;

Proc autoreg data=Table_8_model_4_Analyst_Year_Std plots=none;
   model TP_Retail_Trade_Imb_01_STD_adj=  	TP  Size BM Institutional_holding Turnover  dispersion Past_12m_return Analyst_Coverage Idiosyncratic_Volatility fexp  Relative_EPS_optimism
 											drop_cov Top10_Broker Investment_Bank_Affiliation Broker_Ind_spec/ covest=neweywest(gamma=0,rate=0,constant=6);
RUN;

proc delete data=Table_8_model_4_Analyst_Year_Std ; run;

